/**
 * 功能:整个app的菜单框架
 * 创建日期: 2012-03-19
 * 创建人: 全轩
 * 功能修正说明:
 * 		
 */

if(!this.MeumWin)
{
	this.MeumWin = {};
}

(function(){
	MeumWin.currentTab = {};
	MeumWin.currentTabIndex = 0;
	MeumWin.tabs = [];
	if(typeof MeumWin.Init !== 'function')
	{
		MeumWin.Init = function()
		{
			if(!MeumWin.tabGroup)
			{
				MeumWin.tabGroup = createCustomTabGroup({
					backgroundColor:'#fff',
					barColor:'#000',
				});
				
				/******添加首页菜单******/
				
				 var winIndexForm = Ti.UI.createWindow({
					title:'首页',
					backgroundImage:'images/form/index.jpg',
				});

				var tabIndex = Ti.UI.createTab({
					tilteid:'tbIndex',
					icon:'images/tab/home.png',
					title:'首页',
					custom:true,
					font:{fontWeight:'bold',fontSize:14},
					window:winIndexForm,
					
				});
				tabIndex.addEventListener('focus',function(e){
					MeumWin.currentTab = tabIndex;
					MeumWin.currentTabIndex = 0;
				});
				winIndexForm.addEventListener('open',function(e){
						StatusWin.win = winIndexForm;
						StatusWin.Init();
				});
				MeumWin.tabs.push(tabIndex);
				MeumWin.tabGroup.addTab(tabIndex);
				
				/*********消息************/
				var winMessageForm = Ti.UI.createWindow({
					title:'消息',
					backgroundImage:'images/form/message.jpg',
				});
				
				var tabMessage = Ti.UI.createTab({
					tilteid:'tbMessage',
					icon:'images/tab/email.png',
					title:'消息',
					custom:true,
					font:{fontWeight:'bold',fontSize:14},
					window:winMessageForm,
				});
				tabMessage.addEventListener('focus',function(e){
					MeumWin.currentTab = tabMessage;
					MeumWin.currentTabIndex = 1;
				});
				MeumWin.tabs.push(tabMessage);
				MeumWin.tabGroup.addTab(tabMessage);
				
				/*********资料************/
				var winInfoForm = Ti.UI.createWindow({
					title:'资料',
					backgroundImage:'images/form/info.jpg',
				});
				
				var tabInfo = Ti.UI.createTab({
					tilteid:'tabInfo',
					icon:'images/tab/user.png',
					title:'资料',
					custom:true,
					font:{fontWeight:'bold',fontSize:14},
					window:winInfoForm,
				});
				tabInfo.addEventListener('focus',function(e){
					MeumWin.currentTab = tabInfo;
					MeumWin.currentTabIndex = 2;
				});
				MeumWin.tabs.push(tabInfo);
				MeumWin.tabGroup.addTab(tabInfo);
				
				/*********频道************/
				var winChannelForm = Ti.UI.createWindow({
					title:'频道',
				});
				
				var tabChannel = Ti.UI.createTab({
					tilteid:'tabChannel',
					icon:'images/tab/channel.png',
					title:'频道',
					custom:true,
					font:{fontWeight:'bold',fontSize:14},
					window:winChannelForm,
				});
				tabChannel.addEventListener('focus',function(e){
					MeumWin.currentTab = tabChannel;
					MeumWin.currentTabIndex = 3;
				});
				MeumWin.tabs.push(tabChannel);
				MeumWin.tabGroup.addTab(tabChannel);
				
				/*********更多************/
				var winMoreForm = Ti.UI.createWindow({
					title:'更多',
					backgroundImage:'images/form/more.jpg',
				});
				
				var tabMore = Ti.UI.createTab({
					tilteid:'tabMore',
					icon:'images/tab/more.png',
					font:{fontWeight:'bold',fontSize:14},
					title:'更多',
					custom:true,
					window:winMoreForm,
				});
				tabMore.addEventListener('focus',function(e){
					
					MeumWin.currentTab = tabMore;
					MeumWin.currentTabIndex = 4;
				});
				MeumWin.tabs.push(tabMore);
				MeumWin.tabGroup.addTab(tabMore);
				
				//添加了激活过程中的动画效果
				MeumWin.tabGroup.open({
					transition: Titanium.UI.iPhone && Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT
				});
			}
		}
	}
}())

//SinaApp.MeumWin = MeumWin;




